package win.larryzeal.thymeleaf.web.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

/**
 * Created by 张少昆 on 2017/10/23.
 */
@Controller
@RequestMapping( "/file" )
public class FileController {

	@RequestMapping( "/" )
	public String file(){
		return "file";
	}

	@RequestMapping( "/upload" )
	@ResponseBody
	public String upload(@RequestParam( "demo" ) MultipartFile file){
		System.out.println(file.isEmpty()); //事实证明，只要页面上的input file的value设为空""，就不会传过来！
		return "hehe";
	}
}
